$OpenBSD: patch-lib_ruby_stdlib_ffi_library_rb,v 1.1 2015/07/26 04:40:16 jeremy Exp $
--- lib/ruby/stdlib/ffi/library.rb.orig	Thu Sep 25 21:32:50 2014
+++ lib/ruby/stdlib/ffi/library.rb	Sat Sep 27 23:32:09 2014
@@ -81,6 +81,7 @@ module FFI
       raise LoadError.new("library names list must not be empty") if names.empty?
 
       lib_flags = defined?(@ffi_lib_flags) ? @ffi_lib_flags : FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL
+      libc = FFI::DynamicLibrary.open('libc.so', FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL)
       ffi_libs = names.map do |name|
         if name == FFI::CURRENT_PROCESS
           FFI::DynamicLibrary.open(nil, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL)
@@ -118,7 +119,7 @@ module FFI
           lib
         end
       end
-
+      ffi_libs.unshift(libc)
       @ffi_libs = ffi_libs
     end
 
